//
//  PaymentView.m
//  chongwu
//
//  Created by 隼目 on 2021/9/17.
//

#import "PaymentView.h"

@implementation PaymentView

-(void)creatView{
    
    self.backgroundColor=[UIColor colorWithRed:0 green:0 blue:0 alpha:0.3];
    
    UIView *centerView=[UIView new];
    [self addSubview:centerView];
    [centerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(105*_mainWidth);
        make.right.mas_equalTo(-105*_mainWidth);
        make.centerY.mas_equalTo(0);
        make.height.mas_equalTo(401*_mainHeight);
    }];
    centerView.backgroundColor=[UIColor whiteColor];
    centerView.layer.cornerRadius=25*_mainWidth;
    centerView.layer.shadowColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.05].CGColor;
    centerView.layer.shadowOffset = CGSizeMake(0,2);
    centerView.layer.shadowOpacity = 1;
    centerView.layer.shadowRadius = 4;
    
    UIView *titleView=[UIView new];
    [centerView addSubview:titleView];
    [titleView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.mas_equalTo(0);
        make.height.mas_equalTo(_mainHeight*264);
    }];
    
    UILabel *label=[UILabel new];
    [titleView addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.mas_equalTo(0);
    }];
    label.text=@"是否已完成支付？";
    label.font=[UIFont fontWithName:@"PingFang SC" size:autoScaleW(36)];
    label.textColor=rgba(47,47,47,1);
    
    UIView *xianView=[UIView new];
    [centerView addSubview:xianView];
    [xianView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.height.mas_equalTo(2*_mainHeight);
        make.top.mas_equalTo(titleView.mas_bottom);
    }];
    xianView.backgroundColor=rgba(232,232,232,1);
    
    
    
    UIView *xianView2=[UIView new];
    [centerView addSubview:xianView2];
    [xianView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(0);
        make.width.mas_equalTo(2*_mainHeight);
        make.centerX.mas_equalTo(0);
        make.top.mas_equalTo(xianView.mas_bottom);
    }];
    xianView2.backgroundColor=rgba(232,232,232,1);
    
    UIButton *leftbtn=[UIButton new];
    [centerView addSubview:leftbtn];
    [leftbtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.mas_equalTo(xianView.mas_bottom);
        make.bottom.mas_equalTo(0);
        make.right.mas_equalTo(xianView2.mas_left);
    }];
    [leftbtn setTitle:@"未完成" forState:0];
    [leftbtn setTitleColor:rgba(47,47,47,1) forState:0];
    leftbtn.titleLabel.font=[UIFont fontWithName:@"PingFang SC" size:autoScaleW(36)];
    [leftbtn addTarget:self action:@selector(selectRemovew) forControlEvents:UIControlEventTouchUpInside];
    
    UIButton *rightbtn=[UIButton new];
    [centerView addSubview:rightbtn];
    [rightbtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(0);
        make.top.mas_equalTo(xianView.mas_bottom);
        make.bottom.mas_equalTo(0);
        make.left.mas_equalTo(xianView2.mas_right);
    }];
    [rightbtn setTitle:@"已完成" forState:0];
    [rightbtn setTitleColor:rgba(255,103,0,1) forState:0];
    rightbtn.titleLabel.font=[UIFont fontWithName:@"PingFang SC" size:autoScaleW(36)];
    [rightbtn addTarget:self action:@selector(selecComplete) forControlEvents:UIControlEventTouchUpInside];
    
    
    UIView *leftView=[UIView new];
    [self addSubview:leftView];
    [leftView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.bottom.mas_equalTo(0);
        make.right.mas_equalTo(centerView.mas_left);
    }];

    leftView.userInteractionEnabled=YES;
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(selectRemovew)];
    [leftView addGestureRecognizer:tapGesture];

    UIView *rightView=[UIView new];
    [self addSubview:rightView];
    [rightView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.top.bottom.mas_equalTo(0);
        make.left.mas_equalTo(centerView.mas_right);
    }];

    rightView.userInteractionEnabled=YES;
    UITapGestureRecognizer *tapGesture4 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(selectRemovew)];
    [rightView addGestureRecognizer:tapGesture4];

    UIView *topView=[UIView new];
    [self addSubview:topView];
    [topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(0);
        make.left.mas_equalTo(leftView.mas_right);
        make.right.mas_equalTo(rightView.mas_left);
        make.bottom.mas_equalTo(centerView.mas_top);
    }];
    topView.userInteractionEnabled=YES;
    UITapGestureRecognizer *tapGesture2 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(selectRemovew)];
    [topView addGestureRecognizer:tapGesture2];

    UIView *bottomView=[UIView new];
    [self addSubview:bottomView];
    [bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(0);
        make.left.mas_equalTo(leftView.mas_right);
        make.right.mas_equalTo(rightView.mas_left);
        make.top.mas_equalTo(centerView.mas_bottom);
    }];
    bottomView.userInteractionEnabled=YES;
    UITapGestureRecognizer *tapGesture3 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(selectRemovew)];
    [bottomView addGestureRecognizer:tapGesture3];
}
-(void)selectRemovew{
    [self removeFromSuperview];
}
-(void)selecComplete{
    [self removeFromSuperview];
    self.SelectCashierBlock();
}
@end
